package com.xxx.rpc.common.xml.xsd;

import org.springframework.beans.factory.support.RootBeanDefinition;
import org.springframework.beans.factory.xml.NamespaceHandlerSupport;

import com.xxx.rpc.common.xml.Dubbo;
import com.xxx.rpc.common.xml.tems.Application;
import com.xxx.rpc.common.xml.tems.Protocol;
import com.xxx.rpc.common.xml.tems.Reference;
import com.xxx.rpc.common.xml.tems.Registry;
import com.xxx.rpc.common.xml.tems.Service;

public class DubboNamespaceHandler extends NamespaceHandlerSupport {
    public void init() {
    	RootBeanDefinition beanDefinition = new RootBeanDefinition();
		beanDefinition.setBeanClass(Dubbo.class);
		beanDefinition.setLazyInit(false);
        registerBeanDefinitionParser("application", new DubboBeanDefinitionParser(Application.class,beanDefinition));
        registerBeanDefinitionParser("registry", new DubboBeanDefinitionParser(Registry.class,beanDefinition));
        registerBeanDefinitionParser("protocol", new DubboBeanDefinitionParser(Protocol.class,beanDefinition));
        registerBeanDefinitionParser("service", new DubboBeanDefinitionParser(Service.class,beanDefinition));
        registerBeanDefinitionParser("reference", new DubboBeanDefinitionParser(Reference.class,beanDefinition));
    }
}